<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
/***********************************************
* 파일명   	: comm_table_primary_code_p.jsp
* 기  능      	: 공통그룹코드추가 POP_UP
* 최초 작성일 	: 2009/02/10
* @author 	: Yang D
*************************************************
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
	<link rel="stylesheet" type="text/css" href="style/style.css" />
	<script src="inc/js/common.js"></script>
	<title>대표코드</title>
	
	<script type="text/javascript">
		//하위코드 POP_UP
		function fnc_sub_code_p() {
			
			var f = document.frm;
			
			if (f.group_nm.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length == 0) {
				alert("<s:text name="alert.message.requiedGroupCode" />");
				f.group_nm.focus();
				return false;
			}
			
			//opner의 javascript를 실행한다.
			opener.fnc_sub_add_on_p();
			return false;		
		}
		
		//저장
		function fnc_save(f) {
			if (f.group_nm.value.replace(/^\s\s*/, '').replace(/\s\s*$/, '').length == 0) {
				alert("<s:text name="alert.message.requiedGroupCode" />");
				f.group_nm.focus();
				return false;
			}
			
			if (!confirm("<s:text name="alert.message.questionSave" />")) {
				return false;
			} else {
				f.action = "insertPrimaryCode.action";
				f.submit();
			}
			return false;
		}
		
		//msg 출력
		function fnc_msg() {
			var	msg	=	document.getElementById("msg").value;
			
			if (msg == "OK") {
				alert("<s:text name="alert.message.applied" />");
				opener.frm.cd_nm.value	=	frm.group_nm.value;
				opener.fnc_dojo_publish();
				window.close();
			}
			return false;
		}
	</script>
</head>
<body onload="fnc_msg()">
	<s:form name="frm" id="frm" method="post" theme="simple">
		<s:hidden name="msg" id="msg"/>
		<s:hidden name="group_cd_max" id="group_cd_max"/>
		<s:hidden name="group_cd" id="group_cd"/><!-- 대표코드 -->
		<s:hidden name="crud_type" /><!-- CRUD를 구분. -->
		<div id="popup_550se_top"></div>
		<table align="center">
			<tr>
				<td>대표코드</td>
				<td><s:property value="group_cd" /></td>
			</tr>
			<tr>
				<td>대표코드명</td>
				<td><s:textfield id="group_nm" name="group_nm" maxlength="60" /></td>
			</tr>
			<tr>
				<td>비고</td>
				<td><s:textfield id="etc" name="etc" maxlength="20" value="%{etc}"/></td>
			</tr>
			<tr>
				<td>사용여부</td>
				<td><s:select id="use_yn" name="use_yn" value="%{use_yn}" list="#{'Y':'Y', 'N':'N'}" cssClass="combobox120se" /></td>
			</tr>
			<tr>
				<td><s:submit 	type="image" 	src="/images/btn_save.gif"	cssClass="img_tm" 	value="저장" onclick="return fnc_save(this.form)" /></td>
			<s:if test="%{crud_type != null}">
				<td><s:submit 	type="image" 	src="/images/btn_add02.gif" cssClass="img_tm"	value="하위코드 추가" onclick="return fnc_sub_code_p()"/></td>
			</s:if>
			</tr>
		</table>
		<s:property value="crud_type"/><!-- debug -->
	</s:form>
</body>
</html>